﻿#pragma once
#include <string>

#if defined(_WIN32)
    #include <winsock2.h>
    #include <ws2tcpip.h>

    typedef SOCKET TSocket;
#elif defined(__linux__)
    #include <netdb.h>
    typedef int TSocket;
#endif

bool setup_socket();
bool clean_socket();

//将域名转成IP地址，如果传入的本身就是IP,则返回传入的那个IP
std::string domain2IP(const std::string domain);
int setSocketNonblocking(TSocket socket);